﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace PolePosition.SmartDevices.CommonLibrary.ControlLibrary
{
    public partial class FormFieldLabel : UserControl
    {
        public FormFieldLabel()
        {
            InitializeComponent();
        }

        [System.ComponentModel.EditorBrowsable(EditorBrowsableState.Always)]
        public string TextOnLabel
        {
            get
            {
                return this.transparentLabelLeft.Text;
            }
            set
            {
                this.transparentLabelLeft.Text = value;
            }
        }

        [System.ComponentModel.EditorBrowsable(EditorBrowsableState.Always)]
        public override string Text
        {
            get
            {
                return this.textbox.Text;
            }
            set
            {
                this.textbox.Text = value;
            }
        }

        public TextBox obtenerTextBox
        {
            get
            {
                return this.textbox;
            }
        }

        public enum LabelColors
        {
            Red,
            Green,
            Yellow,
            None
        }

        private LabelColors m_LabelColor = LabelColors.None;
        /// <summary>
        /// Represents the back color of the overall label (LabelColors enum)
        /// </summary>
        [System.ComponentModel.EditorBrowsable(EditorBrowsableState.Always)]
        public LabelColors LabelColor
        {
            get
            {
                return m_LabelColor;
            }
            set
            {
                m_LabelColor = value;
                pictureBoxGreen.Visible = (value == LabelColors.Green);
                pictureBoxYellow.Visible = (value == LabelColors.Yellow);
                pictureBoxRed.Visible = (value == LabelColors.Red);
            }
        }

        private Boolean prop_Enabled = true;
        /// <summary>
        /// Effects the color of the text but not the raising of the Click event
        /// </summary>
        [System.ComponentModel.EditorBrowsable(EditorBrowsableState.Always)]
        public new Boolean Enabled
        {
            get
            {
                return prop_Enabled;
            }
            set
            {
                prop_Enabled = value;
                this.textbox.ForeColor = (value ? Color.Black : Color.Gray);
            }
        }
    }
}
